/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package au.edu.unsw.bookmarket.service.impl;

import au.edu.unsw.bookmarket.actionform.PostAdsBean;
import au.edu.unsw.bookmarket.actionform.SellerBean;
import au.edu.unsw.bookmarket.dao.SellerDao;
import au.edu.unsw.bookmarket.jdo.Seller;
import au.edu.unsw.bookmarket.service.SellerService;
import au.edu.unsw.bookmarket.util.BeanMapping;
import java.util.List;

/**
 *
 * @author gongz
 */
public class SellerServiceImpl implements SellerService {

    SellerDao sellerDao;

    public SellerDao getSellerDao() {
        return sellerDao;
    }

    public void setSellerDao(SellerDao sellerDao) {
        this.sellerDao = sellerDao;
    }

    public void addSeller(PostAdsBean postAdsBean) {
        BeanMapping beanMapping = new BeanMapping();
        try {
            sellerDao.addSellerAsSellerBean(beanMapping.postAdsBean2SellerBean(postAdsBean));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void addSellerDirectly(Seller seller) {
        try {
            sellerDao.addSeller(seller);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public List<SellerBean> getAllSellers() {
        return sellerDao.getAllSellers();
    }

    public boolean removeAllSellers() {
        return sellerDao.removeAllSellers();
    }
}
